package com.societyGames.interceptExercises
{
public class IntCastExpression implements INumberExpression
{
  private var _right:INumberExpression;

  public function IntCastExpression(xml:XML)
  {
    if (xml.children().length() != 1)
    {
      throw new ArgumentError("IntCastExpression requires one child.");
    }
    this._right = Parser.parse(xml.children()[0]);
  }

  public function toString():String
  {
    return "int(" + Object(this._right).toString() + ")";
  }

  //INumberExpression-->
  public function evaluate():Number
  {
    return int(this._right.evaluate());
  }

  //<--INumberExpression
}
}